package com.vrsys.task;

import java.util.Timer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class ScheduleTask {
    @Autowired
    private IDSaveTask idSaveTask;
    private Timer timer = new Timer("isSaveTask",true);

    public ScheduleTask() {
    }

    public void scheduleTask() {
        timer.schedule(idSaveTask, 5000, 6000);
    }

    public void destroyTask() throws Exception {
        idSaveTask.setContinueFlag(false);
        timer.cancel();
    }

    public IDSaveTask getIdSaveTask() {
        return idSaveTask;
    }

    public void setIdSaveTask(IDSaveTask idSaveTask) {
        this.idSaveTask = idSaveTask;
    }
}
